﻿using BO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace StoreWeb.system.Right
{
    public partial class list : System.Web.UI.Page
    {
        Maticsoft.BLL.Rights bll = new Maticsoft.BLL.Rights();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                int totalOrders = bll.GetRecordCount("");
                AspNetPager1.RecordCount = totalOrders;
            }
        }
        void bindData()
        {
            Repeater1.DataSource = bll.GetListByPage("", "", AspNetPager1.StartRecordIndex, AspNetPager1.EndRecordIndex);
            Repeater1.DataBind();
        }

        protected void AspNetPager1_PageChanged(object src, EventArgs e)
        {
            bindData();
        }
        protected string getparentname(string parentcode)
        {
            if (!string.IsNullOrEmpty(parentcode))
            {
                List<Maticsoft.Model.Rights> list = bll.GetModelList("code='" + parentcode + "'");
                if (list.Count > 0)
                    return list[0].rightname;
                else
                    return "--";
            }
            else
                return "--";
        }
        protected string getextension(string ids)
        {
            if (string.IsNullOrEmpty(ids))
                return "";
            string extension = "";
            foreach (var item in ids.Split('|'))
            {
                if (string.IsNullOrEmpty(extension))
                    extension = Enum.GetName(typeof(extension), Convert.ToInt32(item));
                else
                    extension += "," + Enum.GetName(typeof(extension), Convert.ToInt32(item));
            }
            return extension;
        }
    }
}